package com.yoda.youdianda.service.impl;

import com.yoda.youdianda.domain.SysRoleMenu;
import com.yoda.youdianda.mapper.SysMenuMapper;
import com.yoda.youdianda.mapper.SysRoleMenuMapper;
import com.yoda.youdianda.service.SysRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shawn
 * @date 2022年 11月 16日 0:48
 */
@Service
public class SysRoleMenuServiceImpl implements SysRoleMenuService {

    @Autowired
    private SysRoleMenuMapper roleMenuMapper;

    @Override
    public int insertList(String id, List<Integer> menuIds) {
        return roleMenuMapper.insertList(id, menuIds);
    }

    @Override
    public int insert(SysRoleMenu sysRoleMenu) {
        return roleMenuMapper.insert(sysRoleMenu);
    }

    @Override
    public List<String> selectMenuByRoleId(String roleId) {
        return roleMenuMapper.selectMenuByRoleId(roleId);
    }

    /**
     * 按角色id删除关联菜单
     *
     * @param RoleId 角色id
     */
    @Override
    public void deleteByRoleId(String roleId) {
        roleMenuMapper.deleteByRoleId(roleId);
    }
}
